/*
 * @Description:
 * @Version: 2.0
 * @Author: Mason
 * @Date: 2023-10-14 16:07:36
 * @LastEditors: Mason
 * @LastEditTime: 2023-10-14 16:21:32
 */
package config

import (
	"os"

	"github.com/pelletier/go-toml/v2"
)

type Config struct {
	App struct {
		Host string
		Port int
	}

	Mongo struct {
		Addr   string
		DBName string
	}
}

var Default *Config

func InitConfig(path string) {
	data, err := os.ReadFile(path)
	if err != nil {
		panic(err)
	}
	err = toml.Unmarshal(data, &Default)
	if err != nil {
		panic(err)
	}
}
